/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.resource.mapper;

import org.apache.ibatis.annotations.Param;
import org.springblade.modules.resource.entity.Attach;
import org.springblade.modules.resource.vo.AttachVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;

/**
 * 附件表 Mapper 接口
 *  2020-04-28
 * @author LY
 */
public interface AttachMapper extends BaseMapper<Attach> {

	/**
	 * 单张图纸    info-attach excel pdf dwg
	 * @param infoId
	 * @return
	 */
	List<Attach> getAttachByInfoId(Long infoId);


	// 单级图纸下载
	List<Attach> getSingleAttachByInfoId(List<Long> infoIdList);





	/**
	 * 自定义分页
	 *
	 * @param page
	 * @param attach
	 * @return
	 */
	List<AttachVO> selectAttachPage(IPage page, AttachVO attach);

	/**
	 * 通过中间表查询 图纸信息 pdf/dwg/excel
	 */
	List<AttachVO> getDrawingByUploadId(Long uploadId);
	/**
	 * 加载三维图纸
	 */
	List<AttachVO> getThreeDrawingByUploadId(Long uploadId);
	/**
	 * 加载上传的图纸截图信息
	 */
	List<AttachVO> getImgListByUploadId(Long uploadId);

	/**
	 * 得到uploadId下所有的附件信息
	 * @param uploadId
	 * @return
	 */

	List<AttachVO> getAllAttachListById(Long uploadId);



	/**
	 * 通过前端传入的文件名，识别删除的文件（平面）
	 */
	List<AttachVO> getDeleteAttach(Long uploadId,List<String> fileName);
	/**
	 * 通过前端传入的文件名，识别删除的文件（三维）
	 */
	List<AttachVO> getDeleteThreeAttach(Long uploadId,List<String> threeFileName);

	/**
	 * 得到excel所有的bom列表信息
	 * @param uploadId
	 * @return
	 */

	List<AttachVO> getBomExcelByUploadId(Long uploadId);

	/**
	 * 通过uploadid 和设备编号 查询相关的附件信息
	 * @param uploadId
	 * @param drawingNumber
	 * @return
	 */
	AttachVO getAttachByUploadIdAndDrawingNumber(Long uploadId, String drawingNumber);

	/**
	 * 通过uploadId查询根节点以后 其他的附件信息
	 */
	List<AttachVO> getChildAttachList(Long uploadId, String drawingNumber);

	/**
	 * 获取所有的图纸附件
	 * @param uploadId
	 * @return
	 */
	List<AttachVO> findDrawingListByUploadId(Long uploadId);


	List<AttachVO> findAllUploadId(Long uploadId);

	/**
	 * 物理删除附件列表
	 * @param attachIdList
	 */
	void deleteAttachByIds(List<Long> attachIdList);

	/**
	 * 修改附件归档状态
	 * @param attachIdList
	 * @param statusCode
	 */
	int uploadAttachStatus(@Param("attachIdList") List<Long> attachIdList, @Param("statusCode") Integer statusCode);

	/**
	 * 获取附件详情
	 * @param drawingInfoId
	 * @return
	 */
	Attach getAttachByDrawingInfoId(Long drawingInfoId);

}
